package com.tansun.easycare.rule.refemodel.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.tansun.easycare.rule.common.service.impl.RuleBaseServiceImpl;
import com.tansun.easycare.rule.refemodel.dao.RuleReleModelDao;
import com.tansun.easycare.rule.refemodel.entity.RuleReleModel;
import com.tansun.easycare.rule.refemodel.service.RuleReleModelService;

/**
 * 规则引用ServiceImpl
 * @author lixs
 * @version 2019-11-19
 */
@Service("ruleReleModelService")
@Transactional(readOnly = true)
public class RuleReleModelServiceImpl extends RuleBaseServiceImpl<RuleReleModelDao, RuleReleModel> implements RuleReleModelService{

	public RuleReleModel get(String id) {
		return super.get(id);
	}
	
	public List<RuleReleModel> findList(RuleReleModel ruleReleModel) {
		return super.findList(ruleReleModel);
	}
	
	public PageInfo<RuleReleModel> findPage(Page<RuleReleModel> page, RuleReleModel ruleReleModel) {
		return super.findPage(page, ruleReleModel);
	}
	
	@Transactional(readOnly = false)
	public void save(RuleReleModel ruleReleModel) {
		super.save(ruleReleModel);
	}
	
	@Transactional(readOnly = false)
	public void delete(RuleReleModel ruleReleModel) {
		super.delete(ruleReleModel);
	}

	@Override
	public List<RuleReleModel> findReleModelList(String nodeId,String version) {
		// TODO Auto-generated method stub
		Map<String,String>  map  = new  HashMap<String,String>();
		map.put("nodeId", nodeId);
		map.put("treeNodeId", nodeId);
		map.put("version", version);
		return this.dao.findReleModelList(map);
	}

	@Override
	public void deleteByNodeId(String  nodeId) {
		Map<String,String>  map  = new  HashMap<String,String>();
		map.put("nodeId", nodeId);
		this.dao.deleteByNodeId(map);
		
	}

	@Override
	public List<RuleReleModel> findReleModelListForDel(String projectCode,String releCode) {
		Map<String,String> map = new HashMap<>();
		map.put("projectCode",projectCode);
		map.put("rectCode",releCode);
		return this.dao.findReleModelListForDel(map);
	}
}